package com.weisy.signin.bean;

import android.os.Parcel;
import android.os.Parcelable;

import org.litepal.annotation.Column;
import org.litepal.crud.LitePalSupport;

/**
 * @author weisy
 * @function 学生
 * @date 2019/3/21 10:49
 */
public class Student extends LitePalSupport implements Parcelable {
    //学号
    @Column(unique = true)
    private String studentId;
    private String name;
    private String sex;
    private String phone;
    private String imgUrl;
    private String password;
    //专业
    private String major;
    //年级
    private String grade;
    //班级
    private String classes;

    private String device;
    private float score;
    private float midScore;
    private float endScore;

    public Student() {
    }

    protected Student(Parcel in) {
        studentId = in.readString();
        name = in.readString();
        sex = in.readString();
        phone = in.readString();
        imgUrl = in.readString();
        password = in.readString();
        major = in.readString();
        grade = in.readString();
        classes = in.readString();
        device = in.readString();
        score = in.readFloat();
        midScore = in.readFloat();
        endScore = in.readFloat();
    }

    public static final Creator<Student> CREATOR = new Creator<Student>() {
        @Override
        public Student createFromParcel(Parcel in) {
            return new Student(in);
        }

        @Override
        public Student[] newArray(int size) {
            return new Student[size];
        }
    };

    public String getStudentId() {
        return studentId;
    }

    public void setStudentId(String studentId) {
        this.studentId = studentId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getImgUrl() {
        return imgUrl;
    }

    public void setImgUrl(String imgUrl) {
        this.imgUrl = imgUrl;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getMajor() {
        return major;
    }

    public void setMajor(String major) {
        this.major = major;
    }

    public String getGrade() {
        return grade;
    }

    public void setGrade(String grade) {
        this.grade = grade;
    }

    public String getClasses() {
        return classes;
    }

    public void setClasses(String classes) {
        this.classes = classes;
    }

    public String getDevice() {
        return device;
    }

    public void setDevice(String device) {
        this.device = device;
    }

    public float getScore() {
        return score;
    }

    public void setScore(float score) {
        this.score = score;
    }

    public float getMidScore() {
        return midScore;
    }

    public void setMidScore(float midScore) {
        this.midScore = midScore;
    }

    public float getEndScore() {
        return endScore;
    }

    public void setEndScore(float endScore) {
        this.endScore = endScore;
    }

    @Override
    public String toString() {
        return "\"Student\": {" +
                "\"studentId\": \"" + studentId + '\"' +
                ", \"name\": \"" + name + '\"' +
                ", \"sex\": \"" + sex + '\"' +
                ", \"phone\": \"" + phone + '\"' +
                ", \"imgUrl\": \"" + imgUrl + '\"' +
                ", \"password\": \"" + password + '\"' +
                ", \"major\": \"" + major + '\"' +
                ", \"grade\": \"" + grade + '\"' +
                ", \"classes\": \"" + classes + '\"' +
                ", \"device\": \"" + device + '\"' +
                ", \"score\": \"" + score +
                ", \"midScore\": \"" + midScore +
                ", \"endScore\": \"" + endScore +
                '}';
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(studentId);
        dest.writeString(name);
        dest.writeString(sex);
        dest.writeString(phone);
        dest.writeString(imgUrl);
        dest.writeString(password);
        dest.writeString(major);
        dest.writeString(grade);
        dest.writeString(classes);
        dest.writeString(device);
        dest.writeFloat(score);
        dest.writeFloat(midScore);
        dest.writeFloat(endScore);
    }
}
